# Euler Problem 7
# What is the 10001th prime?
primeindex = 10001
primeindex = 10001

import math
#################################
cycles = 50000
cycles = 1
import time
c1 = time.clock()
#for x in xrange(0xFFFFF): pass
for i in range(cycles):
    answer = 0
#################################
### program calculation start ###
#################################

#    done = 0
#    while not done:

    # calculate primes up to maximum number
    checkprime = 3
    primearray = [2]
    while len(primearray) < primeindex:
        for checkfactor in primearray:
            if checkprime % checkfactor == 0:
                break
            if checkfactor**2 > checkprime:
                primearray.append(checkprime)
                break
        checkprime += 1

    #print primearray                               
    
#################################
###  program calculation end  ###
#################################
c2 = time.clock()
if cycles > 1: print "Time spent is %.2f ms" % ((c2-c1)*1000/cycles)
#################################
        
print 'The answer to Problem #7 is >>', primearray[primeindex-1], '<<'

        